package org.vnl.platform.job;

import org.vnl.platform.dk.util.PDKException;
import org.vnl.platform.dk.util.SEVERITY;

/**
 * Job在執行發生錯誤時,應拋出此一類錯誤
 * 
 * @author Vaughan
 *
 */
public class JobExecException extends PDKException {

    /**
     * 
     */
    private static final long serialVersionUID = -4832863537839237010L;

    public static final String JOB_SYSTEM_ID = "JOB";
    public static final String DEFAULT_BUNDLE_NAME = "resource.org.vnl.platform.job.Jobs";

    public JobExecException() {
        super();
    }

    public JobExecException(String systemId, String msg, String severity, Object[] parameters, Throwable cause) {
        super(systemId, msg, severity, parameters, cause);
    }
    
    public JobExecException(String msg, Throwable cause) {
        super(JOB_SYSTEM_ID,msg,SEVERITY.EXCEPTION.toString(), null, cause);
    }
    
    public JobExecException(String msg) {
        super(JOB_SYSTEM_ID,msg,SEVERITY.EXCEPTION.toString(), null, null);
    }
    
    public JobExecException(String msg, String severity) {
        super(JOB_SYSTEM_ID, msg, severity, null, null);
    }
    
    public JobExecException(String msg, String severity, Throwable cause) {
        super(JOB_SYSTEM_ID, msg, severity, null, cause);
    }
    
    public JobExecException(String msg, String severity, Object[] parameters) {
        super(JOB_SYSTEM_ID, msg, severity, parameters, null);
    }
    
    public JobExecException(String msg, String severity, Object[] parameters, Throwable cause) {
        super(JOB_SYSTEM_ID, msg, severity, parameters, cause);
    }
    
    public JobExecException(String msg, Object[] parameters) {
        super(JOB_SYSTEM_ID, msg, SEVERITY.EXCEPTION.toString(), parameters, null);
    }
    
    public JobExecException(String msg, Object[] parameters, Throwable cause) {
        super(JOB_SYSTEM_ID, msg, SEVERITY.EXCEPTION.toString(), parameters, cause);
    }

    public JobExecException(JobErrCode code) {
        super(JOB_SYSTEM_ID, code.toString(), code.getSeverityString(), null, null);
    }

    public JobExecException(JobErrCode code, Throwable cause) {
        super(JOB_SYSTEM_ID, code.toString(), code.getSeverityString(), null, cause);
    }
    
    public JobExecException(JobErrCode code, Object[] parameters) {
        super(JOB_SYSTEM_ID, code.toString(), code.getSeverityString(), parameters, null);
    }
    
    public JobExecException(JobErrCode code, Object[] parameters, Throwable cause) {
        super(JOB_SYSTEM_ID, code.toString(), code.getSeverityString(), parameters, cause);
    }

    @Override
    protected String getDefaultBundleName() {
        return DEFAULT_BUNDLE_NAME;
    }
    
}
